package com.mxx.bu_yang.adapter;

import android.annotation.SuppressLint;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mxx.bu_yang.R;
import com.mxx.bu_yang.response.SourceOderResponse;

import org.jetbrains.annotations.NotNull;

/**
 * 作者：刘江飞
 * 时间：2020/10/14  14:42
 * 邮箱：642371742Z@qq.com
 * 描述：货品批次
 **/
public class SourceOrderAdapter extends BaseQuickAdapter<SourceOderResponse, BaseViewHolder> {
    public SourceOrderAdapter(int layoutResId) {
        super(layoutResId);
        addChildClickViewIds(R.id.ll_source_info);
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, SourceOderResponse response) {
        if (response == null) {
            return;
        }

        TextView tv_name = baseViewHolder.getView(R.id.tv_name);
        TextView tv_batch = baseViewHolder.getView(R.id.tv_batch);
        TextView tv_total_num = baseViewHolder.getView(R.id.tv_total_num);
        TextView tv_check_num = baseViewHolder.getView(R.id.tv_check_num);

        tv_name.setText(response.materialNumber);
        tv_batch.setText(response.lotNumber);
        if (response.storageQuantity == null) {
            response.storageQuantity = 0;
        }
        tv_total_num.setText(response.storageQuantity + "");

        if (response.actualQuantity == null) {
            response.actualQuantity=0;
        }
        tv_check_num.setText(response.actualQuantity + "");
    }
}
